package com.example.wn.common.exception;


import com.example.wn.model.vo.common.ResultCodeEnum;
import lombok.Data;

@Data
public class WeiNongException extends RuntimeException{
    private Integer code;   //错误码
    private String message; //错误信息

    private ResultCodeEnum resultCodeEnum;  //封装结果类
    public WeiNongException(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public WeiNongException(ResultCodeEnum resultCodeEnum){
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }

}
